package com.ybg.utils;

import java.net.SocketAddress;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;

import net.spy.memcached.BroadcastOpFactory;
import net.spy.memcached.CASResponse;
import net.spy.memcached.CASValue;
import net.spy.memcached.ConnectionObserver;
import net.spy.memcached.MemcachedClient;
import net.spy.memcached.MemcachedClientIF;
import net.spy.memcached.MemcachedNode;
import net.spy.memcached.NodeLocator;
import net.spy.memcached.internal.BulkFuture;
import net.spy.memcached.internal.OperationFuture;
import net.spy.memcached.transcoders.Transcoder;

/**
 * 阿里云OCS工具类
 * 
 * @author ningjh
 * @since  2016-07-19
 */
public final class OcsClient implements MemcachedClientIF{
    private MemcachedClient memcachedClient;

    public void setMemcachedClient(MemcachedClient memcachedClient) {
		this.memcachedClient = memcachedClient;
	}

	public Collection<SocketAddress> getAvailableServers() {
        return memcachedClient.getAvailableServers();
    }

    public Collection<SocketAddress> getUnavailableServers() {
        return memcachedClient.getUnavailableServers();
    }

    public Transcoder<Object> getTranscoder() {
        return memcachedClient.getTranscoder();
    }

    public NodeLocator getNodeLocator() {
        return memcachedClient.getNodeLocator();
    }

    public Future<Boolean> append(long cas, String key, Object val) {
        return memcachedClient.append(cas, key, val);
    }

    public Future<Boolean> append(String key, Object val) {
        return memcachedClient.append(key, val);
    }

    public <T> Future<Boolean> append(long cas, String key, T val, Transcoder<T> tc) {
        return memcachedClient.append(cas, key, val, tc);
    }

    public <T> Future<Boolean> append(String key, T val, Transcoder<T> tc) {
        return memcachedClient.append(key, val, tc);
    }

    public Future<Boolean> prepend(long cas, String key, Object val) {
        return memcachedClient.prepend(cas, key, val);
    }

    public Future<Boolean> prepend(String key, Object val) {
        return memcachedClient.prepend(key, val);
    }

    public <T> Future<Boolean> prepend(long cas, String key, T val, Transcoder<T> tc) {
        return memcachedClient.prepend(cas, key, val, tc);
    }

    public <T> Future<Boolean> prepend(String key, T val, Transcoder<T> tc) {
        return memcachedClient.prepend(key, val, tc);
    }

    public <T> Future<CASResponse> asyncCAS(String key, long casId, T value, Transcoder<T> tc) {
        return memcachedClient.asyncCAS(key, casId, value, tc);
    }

    public Future<CASResponse> asyncCAS(String key, long casId, Object value) {
        return memcachedClient.asyncCAS(key, casId, value);
    }

    public Future<CASResponse> asyncCAS(String key, long casId, int exp, Object value) {
        return memcachedClient.asyncCAS(key, casId, exp, value);
    }

    public <T> OperationFuture<CASResponse> asyncCAS(String key, long casId, int exp, T value, Transcoder<T> tc) {
        return memcachedClient.asyncCAS(key, casId, exp, value, tc);
    }

    public <T> CASResponse cas(String key, long casId, int exp, T value, Transcoder<T> tc) {
        return memcachedClient.cas(key, casId, exp, value, tc);
    }

    public CASResponse cas(String key, long casId, Object value) {
        return memcachedClient.cas(key, casId, value);
    }

    public CASResponse cas(String key, long casId, int exp, Object value) {
        return memcachedClient.cas(key, casId, exp, value);
    }

    public <T> CASResponse cas(String key, long casId, T value, Transcoder<T> tc) {
        return memcachedClient.cas(key, casId, value, tc);
    }

    public <T> Future<Boolean> add(String key, int exp, T o, Transcoder<T> tc) {
        return memcachedClient.add(key, exp, o, tc);
    }

    public Future<Boolean> add(String key, int exp, Object o) {
        return memcachedClient.add(key, exp, o);
    }

    public <T> Future<Boolean> set(String key, int exp, T o, Transcoder<T> tc) {
        return memcachedClient.set(key, exp, o, tc);
    }

    public Future<Boolean> set(String key, int exp, Object o) {
        return memcachedClient.set(key, exp, o);
    }

    public <T> Future<Boolean> replace(String key, int exp, T o, Transcoder<T> tc) {
        return memcachedClient.replace(key, exp, o, tc);
    }

    public Future<Boolean> replace(String key, int exp, Object o) {
        return memcachedClient.replace(key, exp, o);
    }

    public <T> Future<T> asyncGet(String key, Transcoder<T> tc) {
        return memcachedClient.asyncGet(key, tc);
    }

    public Future<Object> asyncGet(String key) {
        return memcachedClient.asyncGet(key);
    }

    public Future<CASValue<Object>> asyncGetAndTouch(String key, int exp) {
        return memcachedClient.asyncGetAndTouch(key, exp);
    }

    public <T> Future<CASValue<T>> asyncGetAndTouch(String key, int exp, Transcoder<T> tc) {
        return memcachedClient.asyncGetAndTouch(key, exp, tc);
    }

    public CASValue<Object> getAndTouch(String key, int exp) {
        return memcachedClient.getAndTouch(key, exp);
    }

    public <T> CASValue<T> getAndTouch(String key, int exp, Transcoder<T> tc) {
        return memcachedClient.getAndTouch(key, exp, tc);
    }

    public <T> Future<CASValue<T>> asyncGets(String key, Transcoder<T> tc) {
        return memcachedClient.asyncGets(key, tc);
    }

    public Future<CASValue<Object>> asyncGets(String key) {
        return memcachedClient.asyncGets(key);
    }

    public <T> CASValue<T> gets(String key, Transcoder<T> tc) {
        return memcachedClient.gets(key, tc);
    }

    public CASValue<Object> gets(String key) {
        return memcachedClient.gets(key);
    }

    public <T> T get(String key, Transcoder<T> tc) {
        return memcachedClient.get(key, tc);
    }

    public Object get(String key) {
        return memcachedClient.get(key);
    }

    public <T> BulkFuture<Map<String, T>> asyncGetBulk(Iterator<String> keys, Iterator<Transcoder<T>> tcs) {
    	return memcachedClient.asyncGetBulk(keys, tcs);
    }

    public <T> BulkFuture<Map<String, T>> asyncGetBulk(Collection<String> keys, Iterator<Transcoder<T>> tcs) {
    	return memcachedClient.asyncGetBulk(keys, tcs);
    }

    public <T> BulkFuture<Map<String, T>> asyncGetBulk(Iterator<String> keys, Transcoder<T> tc) {
    	return memcachedClient.asyncGetBulk(keys, tc);
    }

    public <T> BulkFuture<Map<String, T>> asyncGetBulk(Collection<String> keys, Transcoder<T> tc) {
        return memcachedClient.asyncGetBulk(keys, tc);
    }

    public BulkFuture<Map<String, Object>> asyncGetBulk(Iterator<String> keys) {
        return memcachedClient.asyncGetBulk(keys);
    }

    public BulkFuture<Map<String, Object>> asyncGetBulk(Collection<String> keys) {
        return memcachedClient.asyncGetBulk(keys);
    }

    public <T> BulkFuture<Map<String, T>> asyncGetBulk(Transcoder<T> tc, String... keys) {
        return memcachedClient.asyncGetBulk(tc, keys);
    }

    public BulkFuture<Map<String, Object>> asyncGetBulk(String... keys) {
        return memcachedClient.asyncGetBulk(keys);
    }

    public <T> Map<String, T> getBulk(Iterator<String> keys, Transcoder<T> tc) {
        return memcachedClient.getBulk(keys, tc);
    }

    public <T> Map<String, T> getBulk(Collection<String> keys, Transcoder<T> tc) {
        return memcachedClient.getBulk(keys, tc);
    }

    public Map<String, Object> getBulk(Iterator<String> keys) {
        return memcachedClient.getBulk(keys);
    }

    public Map<String, Object> getBulk(Collection<String> keys) {
        return memcachedClient.getBulk(keys);
    }

    public <T> Map<String, T> getBulk(Transcoder<T> tc, String... keys) {
        return memcachedClient.getBulk(tc, keys);
    }

    public Map<String, Object> getBulk(String... keys) {
        return memcachedClient.getBulk(keys);
    }

    public <T> Future<Boolean> touch(String key, int exp, Transcoder<T> tc) {
        return memcachedClient.touch(key, exp, tc);
    }

    public <T> Future<Boolean> touch(String key, int exp) {
        return memcachedClient.touch(key, exp);
    }

    public Map<SocketAddress, String> getVersions() {
        return memcachedClient.getVersions();
    }

    public Map<SocketAddress, Map<String, String>> getStats() {
        return memcachedClient.getStats();
    }

    public Map<SocketAddress, Map<String, String>> getStats(String prefix) {
        return memcachedClient.getStats(prefix);
    }

    public long incr(String key, long by) {
        return memcachedClient.incr(key, by);
    }

    public long incr(String key, int by) {
        return memcachedClient.incr(key, by);
    }

    public long decr(String key, long by) {
        return memcachedClient.decr(key, by);
    }

    public long decr(String key, int by) {
        return memcachedClient.decr(key, by);
    }

    public Future<Long> asyncIncr(String key, long by) {
        return memcachedClient.asyncIncr(key, by);
    }

    public Future<Long> asyncIncr(String key, int by) {
        return memcachedClient.asyncIncr(key, by);
    }

    public Future<Long> asyncDecr(String key, long by) {
        return memcachedClient.asyncDecr(key, by);
    }

    public Future<Long> asyncDecr(String key, int by) {
        return memcachedClient.asyncDecr(key, by);
    }

    public long incr(String key, long by, long def, int exp) {
        return memcachedClient.incr(key, by, def, exp);
    }

    public long incr(String key, int by, long def, int exp) {
        return memcachedClient.incr(key, by, def, exp);
    }

    public long decr(String key, long by, long def, int exp) {
        return memcachedClient.decr(key, by, def, exp);
    }

    public long decr(String key, int by, long def, int exp) {
        return memcachedClient.decr(key, by, def, exp);
    }

    public Future<Long> asyncIncr(String key, long by, long def, int exp) {
        return memcachedClient.asyncIncr(key, by, def, exp);
    }

    public Future<Long> asyncIncr(String key, int by, long def, int exp) {
        return memcachedClient.asyncIncr(key, by, def, exp);
    }

    public Future<Long> asyncDecr(String key, long by, long def, int exp) {
        return memcachedClient.asyncDecr(key, by, def, exp);
    }

    public Future<Long> asyncDecr(String key, int by, long def, int exp) {
        return memcachedClient.asyncDecr(key, by, def, exp);
    }

    public long incr(String key, long by, long def) {
        return memcachedClient.incr(key, by, def);
    }

    public long incr(String key, int by, long def) {
        return memcachedClient.incr(key, by, def);
    }

    public long decr(String key, long by, long def) {
        return memcachedClient.decr(key, by, def);
    }

    public long decr(String key, int by, long def) {
        return memcachedClient.decr(key, by, def);
    }

    public Future<Long> asyncIncr(String key, long by, long def) {
        return memcachedClient.asyncIncr(key, by, def);
    }

    public Future<Long> asyncIncr(String key, int by, long def) {
        return memcachedClient.asyncIncr(key, by, def);
    }

    public Future<Long> asyncDecr(String key, long by, long def) {
        return memcachedClient.asyncDecr(key, by, def);
    }

    public Future<Long> asyncDecr(String key, int by, long def) {
        return memcachedClient.asyncDecr(key, by, def);
    }

    public Future<Boolean> delete(String key) {
        return memcachedClient.delete(key);
    }

    public Future<Boolean> delete(String key, long cas) {
        return memcachedClient.delete(key, cas);
    }

    public Future<Boolean> flush(int delay) {
        return memcachedClient.flush(delay);
    }

    public Future<Boolean> flush() {
        return memcachedClient.flush();
    }

    public void shutdown() {
    	memcachedClient.shutdown();
    }

    public boolean shutdown(long timeout, TimeUnit unit) {
        return memcachedClient.shutdown(timeout, unit);
    }

    public boolean waitForQueues(long timeout, TimeUnit unit) {
        return memcachedClient.waitForQueues(timeout, unit);
    }

    public boolean addObserver(ConnectionObserver obs) {
        return memcachedClient.addObserver(obs);
    }

    public boolean removeObserver(ConnectionObserver obs) {
        return memcachedClient.removeObserver(obs);
    }

    public CountDownLatch broadcastOp(BroadcastOpFactory of) {
        return memcachedClient.broadcastOp(of);
    }

    public CountDownLatch broadcastOp(BroadcastOpFactory of, Collection<MemcachedNode> nodes) {
        return memcachedClient.broadcastOp(of, nodes);
    }

    public Set<String> listSaslMechanisms() {
        return memcachedClient.listSaslMechanisms();
    }
}
